home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 44 / Amiga Format CD44 (1999-08-26)(Future Publishing)(GB)(Track 1 of 3)[!][issue 1999-10].iso / -in_the_mag- / basics / blitz / doselmorelib22.lha / docs / ElmoreDosLib.doc
Text File  |  1995-06-16  |  15KB  |  511 lines

  1.                            ELMOREDOSLIB Version 2.2
  2.  
  3.                       Copyright © 1995 HeadSoft Software
  4.                          Written by Richard T. Elmore
  5.  
  6.                                126 State St. #20
  7.                               Spearfish, SD 57783
  8.  
  9.                               Tel: (605) 348-3337
  10.                        E-mail: relmore@silver.sdsmt.edu
  11.  
  12.  
  13. Note:   This  version of the library will not function for v36 (2.04) and below
  14. of the OS.  Furthermore, you will note that some command names are preceeded by
  15. a  asterisk.   This indicates that either the command is new to this release or
  16. was enhanced/bugfixed since the last (Bum6) release.
  17.  
  18.  
  19. *Command: CHDIR
  20. ---------------
  21. Syntax: CHDIR "Path:"  -or-  IF CHDIR("Path:") Then...
  22.  
  23. This  command  will  change the current working directory for ALL disk- related
  24. commands.   Used  as  a  function,  a  value  of  TRUE  will be returned if the
  25. directory change was successful, or FALSE if it was unsuccessful.
  26.  
  27.  
  28. *Function: CurrentDir$
  29. ----------------------
  30. Syntax: a$=CurrentDir$
  31.  
  32. This  function  returns  a  string  containing the full pathname of the current
  33. directory.   This  function  replaces  the  "PATHLOCK"  function  from  earlier
  34. releases of this library.
  35.  
  36.  
  37. *Command: COPYFILE
  38. ------------------
  39. Syntax: COPYFILE "First","SECOND"  -or-  IF COPYFILE("FIRST","SECOND") Then...
  40.  
  41. This command will copy files, much like the CLI command "Copy." In the function
  42. form,  it  will  return TRUE for success, and FALSE for failure.  Note that the
  43. speed at which it copies can be increased by increasing the "CopyBuffer," which
  44. defaults to 4096 bytes.  (See below)
  45.  
  46.  
  47. *Statement: SetCopyBuffer
  48. -------------------------
  49. Syntax: SetCopyBuffer BUFFERSIZE
  50.  
  51. This statement is used to set the size of the COPYFILE command's memory buffer.
  52. The  default  size  is  4096 bytes, but this can be adjusted from 1024 bytes to
  53. nearly  all your free memory.  A larger buffer will normally increase the speed
  54. at  which the COPYFILE command operates, but only up to the size of the largest
  55. file  you're  copying.   For  example,  if the largest file you need to copy is
  56. 25000 bytes, then it will be useless to set the COPYBUFFER above 25000.
  57.  
  58.  
  59. *Command: NAMEFILE
  60. ------------------
  61. Syntax: NAMEFILE "Oldname","Newname"  -or-
  62.         IF NAMEFILE("Oldname","Newname") Then...
  63.  
  64. This  command  returns FALSE for failure, TRUE for success:  The file "oldname"
  65. is  renamed  to  "newname,"  if possible, and may be moved to other directories
  66. within  the same volume.  It is not possible to use NAMEFILE to move a file
  67. from one volume to another, however.  (See the MOVEFILE command)
  68.  
  69.  
  70. *Command: MOVEFILE
  71. ------------------
  72. Syntax: MOVEFILE "Oldname","Newname" -or-
  73.         IF MOVEFILE("Oldname","Newname") Then...
  74.  
  75. This  command  returns  FALSE  for  failure, TRUE for success:  This command is
  76. intelligent, and will attempt to rename the given filename if it is on the same
  77. volume,  otherwise  it  will  copy  the file to the new location and afterwards
  78. delete the original.
  79.  
  80.  
  81. Command: MAKEDIR
  82. ----------------
  83. Syntax: MAKEDIR "Path:Dir"  -or-  If MAKEDIR("Path:Dir") Then...
  84.  
  85. This  command  will  attempt to create a new directory with the given pathname.
  86. It  is  only  possible  to  create  one level at a time, however.  For example,
  87. MAKEDIR  will  fail  if  you attempt to MAKEDIR "RAM:New/Data" if the directory
  88. "RAM:New"  does  not  yet  exist.  Used as a function, MAKEDIR returns TRUE for
  89. success, and FALSE for failure.
  90.  
  91.  
  92. *Command: MOREENTRIES
  93. ---------------------
  94. Syntax: MOREENTRIES  -or-  If MOREENTRIES Then...
  95.  
  96. This  command  will read the next entry in the current directory for inspection
  97. with  other "ENTRY" commands.  Used within a loop, it is easy to read an entire
  98. directory  with  these  commands,  similar  to  the "DIR" or "LIST" commands of
  99. AmigaDOS.  (See below.  An example follows)
  100.  
  101.  
  102. Function: ENTRYNAME$
  103. --------------------
  104. Syntax: n$=ENTRYNAME$
  105.  
  106. This  function returns the name of the current directory entry.  If used before
  107. the  fist  "MOREENTRIES"  command, it will return the name of the last EXAMINEd
  108. directory or file.
  109.  
  110.  
  111. Function: ENTRYDIR
  112. ------------------
  113. Syntax: If ENTRYDIR Then...
  114.  
  115. This function returns TRUE if the last EXAMINEd object is a directory, or FALSE
  116. if it is a file.
  117.  
  118.  
  119. *Function: ENTRYBITS$
  120. ---------------------
  121. Syntax: n$=ENTRYBITS$
  122.  
  123. This  function  returns  a  string containing the protection-bits status of the
  124. current  file  or  directory.   An example may be "----RWED" the same format as
  125. given  by  the  AmigaDOS  "LIST"  command.   Possible bit settings are HSARWED:
  126. H=HIDDEN,   S=SCRIPT,   A=ARCHIVED,   R=READABLE,  W=WRITEABLE,  E=EXECUTEABLE,
  127. D=DELETEABLE.   Any  bits that are not set will have the "-" character in their
  128. place.
  129.  
  130.  
  131. Function: ENTRYSIZE
  132. -------------------
  133. Syntax: n.l=ENTRYSIZE
  134.  
  135. This  function  returns the size in bytes of the current directory entry.  Note
  136. that sub-directories return a size of zero whether they are empty or not.
  137.  
  138.  
  139. Function: ENTRYDATE
  140. -------------------
  141. Syntax: d$=DATE$(ENTRYDATE)
  142.  
  143. This function returns the date the current entry was last modified, in the same
  144. format  as  SYSTEMDATE uses.  (The number of days since 1/1/1978) Thus, you may
  145. use the DATE$ and DATEFORMAT commands to translate it into a string with a more
  146. human-readable string.
  147.  
  148.  
  149. Function: ENTRYHOUR, ENTRYMINS, ENTRYSECS
  150. -----------------------------------------
  151. Syntax: h=ENTRYHOUR:m=ENTRYMINS:s=ENTRYSECS
  152.  
  153. ENTRYHOUR:
  154. This  function  is related to ENTRYDATE, above, but returns the hour of the day
  155. (0-23) at which the entry was last modified.
  156.  
  157. ENTRYMINS:
  158. Returns the minute (0-59) of the time at which the entry was modified.
  159.  
  160. ENTRYSECS:
  161. Returns the second (0-59) of the time at which the entry was modified.
  162.  
  163.  
  164.  
  165. Function: ENTRYCOMMENT$
  166. -----------------------
  167. Syntax: c$=ENTRYCOMMENT$
  168.  
  169. This  function  will  return the string containing the filenote for the current
  170. directory entry, or "" if there is none.
  171.  
  172.  
  173. Statement: NOMOREENTRIES
  174. ------------------------
  175. Syntax: NOMOREENTRIES
  176.  
  177. The  EXAMINE  command  "locks"  the examined directory (or file) until the last
  178. entry has been examined.  In previous versions of the library, it was therefore
  179. not possible to alter the locked directory or file until the last MOREENTRIES()
  180. function  had  been called or the program had ended.  This statement allows you
  181. to prematurely terminate the lock.
  182.  
  183.  
  184.  
  185. *********************
  186. * DIRECTORY EXAMPLE *
  187. *********************
  188.  
  189. This  example  will  list  the entries in RAM:  in a format very similar to the
  190. AmigaDOS "LIST" command.  Note that you need to "ChDir" to a directory in order
  191. to read it from the first entry again.
  192.  
  193.  
  194. ChDir "RAM:"
  195.  
  196. While MoreEntries
  197.   Print LSet$(EntryName$,30)
  198.   If EntryDIR then Print "Dir   " Else Print LSet$(Str$(EntrySize),6)
  199.   Print EntryBits$," ",Date$(EntryDate)," "
  200.   Print EntryHour,":",Right$("0"+Str$(EntryMins),2),":"
  201.   NPrint Right$("0"+Str$(EntrySecs),2)
  202. Wend
  203.  
  204. MouseWait
  205.  
  206.  
  207.  
  208.  
  209. Command: ANALYZEDISK
  210. --------------------
  211. Syntax: ANALYZEDISK "DRIVE:"  -or-  If ANALYZEDISK "DRIVE:" Then...
  212.  
  213. This  command  returns FALSE if the specified device or pathname was not valid.
  214. If successful, details about the specified drive can be read with the following
  215. "DISK"  functions.   The  values  for  these  functions  will  not change until
  216. ANALYZEDISK  is executed again, either on the same drive or another one.  Note:
  217. If  given  a  full  pathname,  such as "DF0:System/Utilities" this command will
  218. still know enough to analyze the disk "DF0:"
  219.  
  220.  
  221. Function: DISKUNIT
  222. ------------------
  223. Syntax: n=DISKUNIT
  224.  
  225. This  function  will return the unit number of the most recently analyzed disk.
  226. DF0:  for example, would return zero, while DF1:  would return 1.
  227.  
  228.  
  229. Function: DISKERRS
  230. ------------------
  231. Syntax: n=DISKERRS
  232.  
  233. This function will return the number of soft errors DOS knows about on the last
  234. analyzed disk.  This should normally be zero.
  235.  
  236.  
  237.  
  238. Function: DISKCAPACITY
  239. ----------------------
  240. Syntax: n=DISKCAPACITY
  241.  
  242. This  function  returns  the capacity in bytes of the last analyzed drive.  For
  243. example,   a   fastfilesystem-formatted   disk's   max  capacity  is  837K,  so
  244. DISKCAPACITY would return 857904, which divided by 1024 is 837.
  245.  
  246.  
  247.  
  248. Function: DISKUSED
  249. ------------------
  250. Syntax: n=DISKUSED
  251.  
  252. This  function returns the number of bytes actually in-use on the last analyzed
  253. drive.
  254.  
  255.  
  256.  
  257. Function: DISKFREE
  258. ------------------
  259. Syntax: n=DISKFREE
  260.  
  261. The  opposite  of  DISKUSED,  DISKFREE  returns the number of bytes free on the
  262. disk.   This  function  would  be  very  useful, for example, in a program that
  263. needed  to  save  information to disk.  You would be able to first determine if
  264. the specified SAVE disk had sufficient space.
  265.  
  266.  
  267. Function: DISKBLOCKS
  268. --------------------
  269. Syntax: n=DISKBLOCKS
  270.  
  271. This  function returns the number of bytes each block on a disk uses, making it
  272. possible to convert the byte-values of the above functions to number of blocks.
  273.  
  274.  
  275. *Function: DISKSTATE
  276. --------------------
  277. Syntax: state=DISKSTATE
  278.  
  279. Returns the state of the last-analyzed drive:
  280.  
  281. 0 - Disk is Write-Protected
  282. 1 - Disk is Validating
  283. 2 - Disk is Validated (i.e. normal)
  284.  
  285.  
  286. *Function: DISKTYPE$
  287. -------------------
  288. Syntax: id$=DISKTYPE$
  289.  
  290. This  function  returns  a  string indicating the format-ID of the last analyze
  291. disk.
  292.  
  293.  
  294.  
  295.  
  296.  
  297. *Command: GETASSIGNS
  298. --------------------
  299. Syntax: GETASSIGNS <type>   -or-   If GETASSIGNS(<type>) Then...
  300.  
  301. This  command  reads  the  current  list  of  assigns,  devices,  or volumes as
  302. indicated by <type>:
  303.  
  304. 0=Devices        (Such as DH0: SER: CON: etc.)
  305. 1=Directories    (Such as S: DEVS: FONTS: etc.)
  306. 2=Volumes        (Such as Work: Workbench: etc.)
  307.  
  308. The strings may be read in with the ASSIGN$ function.
  309.  
  310.  
  311. *Function: ASSIGN$
  312. ------------------
  313. Syntax: a$=ASSIGN$
  314.  
  315. This  function returns the next item in the assignment list (see GETASSIGNS) or
  316. null.  A null string indicates that there are no more entries in the list.
  317.  
  318. Example:
  319.  
  320. If GetAssigns(2)
  321.   Repeat
  322.     a$=Assign$
  323.     If a$ Then NPrint a$
  324.   Until a$=""
  325. EndIf
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332. *Command: SetFileComment
  333. ------------------------
  334. Syntax: SetFileComment file$,text$   -or-   If SetFileComment(file$,text$) Then...
  335.  
  336. This  command  is the reverse of ENTRYCOMMENT$--- it lets you write the comment
  337. to the specified filename.
  338.  
  339.  
  340.  
  341. *Command: SetBits
  342. -----------------
  343. Syntax: SetBits bits$,bits$    -or-    If SetBits(bits$,bits) Then...
  344.  
  345. This command is the reverse of ENTRYBITS$.  You may specify the protection bits
  346. of the named file (case insensitive) from H, S, P, A, R, W, E, and D.
  347.  
  348. Example:
  349.  
  350. If SetBits("RWED","RAM:Myprog")=0 Then Goto Failed
  351.  
  352.  
  353.  
  354.  
  355. *Command: SetWildString
  356. -----------------------
  357. Syntax: SetWildString pat$   -or-   If SetWildString(pat$) Then...
  358.  
  359. Finally!  Easy pattern-matching!  This command defines the wildcard pattern to
  360. be used by the MatchWild() function (below.)  As a function, it will return one 
  361. of the following values:
  362.  
  363. 0- Function failed
  364.  
  365. 1- Successful, string contained valid wildcard pattern
  366.  
  367. 2- Successful, but string contained no wildcard characters (possibly only a
  368. filename, etc.)
  369.  
  370. The  pattern-matching method is identical to the LIST command, file requesters,
  371. etc.
  372.  
  373.  
  374. *Function: MatchWild
  375. --------------------
  376. Syntax: <match?>=MatchWild(text$)
  377.  
  378. This  function  returns TRUE if the supplied string matches the pattern defined
  379. by SetWildString.
  380.  
  381.  
  382.  
  383. *Function: DosError$
  384. --------------------
  385. Syntax: error$=DosError$
  386.  
  387. This  function  returns  a string explaining the reason for failure of the last
  388. DOS action...  ("object is in use", etc.)
  389.  
  390.  
  391.  
  392. *Function: FilePart$
  393. --------------------
  394. Syntax: f$=FilePart$(pathstring$)
  395.  
  396. This  function splits the given string and returns the filename portion...  For
  397. example, FilePart$("Dh0:S/User-Startup") would return "User-Startup".
  398.  
  399.  
  400. *Function: PathPart$
  401. --------------------
  402. Syntax: p$=PathPart$(pathstring$)
  403.  
  404. This  function  works  similarly to FilePart$() but returns the Pathname within
  405. the specified string.  PathPart$("Dh0:S/User-Startup") would return "Dh0:S".
  406.  
  407.  
  408. *Function: FullPath$
  409. --------------------
  410. Syntax: a$=FullPath$(path$,file$)
  411.  
  412. This function combines the directory and filenames supplied in a DOS-compatible
  413. manner...  FullPath$("DH0:S","User-Startup") would return "DH0:S/User-Startup".
  414.  
  415.  
  416.  
  417. *Function: GetLocal$
  418. --------------------
  419. Syntax: v$=GetLocal$(name$)
  420.  
  421. The  value  of the named DOS local-variable will be returned as a string.  (See
  422. CLI command, "SET", "SETENV" etc.)
  423.  
  424.  
  425. *Function: GetEnv$
  426. ------------------
  427. Syntax: v$=GetEnv$(name$)
  428.  
  429. The environmental DOS variable will be returned in a string.
  430.  
  431.  
  432.  
  433. *Command: SetLocal
  434. ------------------
  435. Syntax: SetLocal name$,value$   -or-   If SetLocal(name$,value$) Then...
  436.  
  437. This command will attempt to set the value of the DOS local-variable specified.
  438.  
  439.  
  440. *Command: SetEnv
  441. ----------------
  442. Syntax: SetEnv name$,value$   -or   If SetEnv(name$,value$) Then...
  443.  
  444. This  command  will  attempt to set the value of the DOS environmental variable
  445. specified.  (The value is copied to a file in the ENV:  directory.)
  446.  
  447.  
  448. *Command: UnSetLocal
  449. --------------------
  450. Syntax: UnSetLocal name$   -or-   If UnSetLocal(name$) Then...
  451.  
  452. This command removes the specified local DOS variable.
  453.  
  454.  
  455.  
  456. *Command: UnSetEnv
  457. ------------------
  458. Syntax: UnSetEnv name$    -or-    If UnSetEnv(name$) Then...
  459.  
  460. This command removes the specified environmental DOS variable.
  461.  
  462.  
  463.  
  464. *Command: Run
  465. -------------
  466. Syntax: Run filename$,args$[,stacksize.l]   -or-
  467.         *Process=Run(filename$,args$[,stacksize])
  468.  
  469. This command runs the specified executeable program as a background process.
  470.  
  471.  
  472.  
  473. *Statement: Exec
  474. ----------------
  475. Syntax: Exec command$
  476.  
  477. The specified commandline will be executed.  Note that miniature scripts may be
  478. created by separating individual commandlines by CHR$(10).
  479.  
  480.  
  481.  
  482. *Function: ComparePaths
  483. -----------------------
  484. Syntax: result=ComparePaths(pathname1$,pathname2$)
  485.  
  486. This function compares the supplied pathnames and returns:
  487.  
  488. 0 = The files or directories specified by the two pathnames are unrelated.
  489. 1 = The files or directories specified by the two pathnames are really the same
  490.     file (for example, "SYS:C/Dir" and "C:dir" are the same thing.)
  491. 2 = The files or directories specified are not the same file (or directory,) but
  492.     they do reside on the same volume.
  493.  
  494.  
  495.  
  496. *Command: Assign
  497. ----------------
  498. Syntax: Assign name$,pathname$   -or-   If Assign(name$,path$) Then...
  499.  
  500. This  command  creates  a new assign (similar to the SYS:C/Assign command.) For
  501. example, Assign "Blitz2:","DH4:Prg/Blitz2".
  502.  
  503. Note  that  the  trailing  colon  on the new ASSIGN name (Blitz2:  in the above
  504. example) is optional.
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.